var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = new ((function () {
    function t() {
        (this.host = "https://play.qwplay.cn/game/"),
            (this.getRankListUrl = this.host + "getSKRankList"),
            (this.getRankUrl = this.host + "getSKRank"),
            (this.uploadScoreUrl = this.host + "ttUploadSKResult"),
            (this.contentSafeTT = this.host + "contentSafeTT"),
            (this.contentSafeKS = this.host + "contentSafeKS"),
            (this.contentSafeWX = this.host + "contentSafeWX"),
            (this.contentSafeAll = this.host + "contentSafeAll"),
            (this.seed = 0),
            (this._soundOpen = 0),
            (this._shockOpen = 0);
    }
    return (
        (t.prototype.stopAllSound = function () {
            cc.audioEngine.stopAllEffects();
        }),
        (t.prototype.isPlayingMusic = function () {
            return cc.audioEngine.isMusicPlaying();
        }),
        (t.prototype.playMusic = function (t, e) {
            return cc.audioEngine.playMusic(t, e);
        }),
        (t.prototype.stopMucis = function () {
            cc.audioEngine.stopMusic();
        }),
        (t.prototype.playSound = function (t, e) {
            if (1 == this._soundOpen) return cc.audioEngine.setEffectsVolume(0.8), cc.audioEngine.playEffect(t, e);
        }),
        (t.prototype.formatCount = function (t) {
            return t > 9999 ? (t = (t / 1e4) >> 0) + "W" : t;
        }),
        (t.prototype.stopSound = function (t) {
            cc.audioEngine.stopEffect(t);
        }),
        (t.prototype.createImage = function (t, e) {
            t &&
                "undefined" != t &&
                "" != t &&
                cc.loader.load({url: t, type: "png"}, function (t, o) {
                    t || (e.spriteFrame = new cc.SpriteFrame(o));
                });
        }),
        (t.prototype.calcExpressionWithoutQuote = function (t) {
            if (t.indexOf("(") > -1 || t.indexOf(")") > -1) return this.calcExpression(t);
            for (var e = [], o = [], i = -1, s = 0; s < t.length; s++) {
                var r = t.charAt(s);
                this.isOperatorChar(r) && ((e[e.length] = r), (o[o.length] = t.substring(i + 1, s)), (i = s)),
                    s == t.length - 1 && i < s && (o[o.length] = t.substring(i + 1, t.length));
            }
            if (e.length <= 0 || o.length <= 0) return t;
            for (; e.indexOf("*") > -1 || e.indexOf("/") > -1; ) {
                e.forEach(function (t, i) {
                    if ("*" == t || "/" == t) {
                        var s = n.calcExpressionWithSingleOperator(o[i], o[i + 1], t);
                        e.splice(i, 1), o.splice(i, 2, [s]);
                    }
                });
            }
            var c = 1 * o[0];
            if (e.indexOf("+") > -1 || e.indexOf("-") > -1) {
                for (var a = 0; a < e.length; a++) {
                    var u = e[a];
                    ("+" != u && "-" != u) || (c = n.calcExpressionWithSingleOperator(c, o[a + 1], u));
                }
                return c;
            }
            return 1 * o[0];
        }),
        (t.prototype.calcExpressionWithSingleOperator = function (t, e, o) {
            return "+" == o ? 1 * t + 1 * e : "-" == o ? 1 * t - 1 * e : "*" == o ? t * e : "/" == o ? t / e : NaN;
        }),
        (t.prototype.calcExpression = function (t) {
            if (
                ((t = t
                    .replace(/\s/g, "")
                    .replace(/\xf7/g, "/")
                    .replace(/x/g, "*")
                    .replace(/\xd7/g, "*")
                    .replace(/X/g, "*")),
                this.getCharCountInString(t, "(") != this.getCharCountInString(t, ")"))
            )
                return NaN;
            for (; t && t.indexOf("(") > -1 && t.indexOf(")") > -1; ) {
                for (var e = t.indexOf(")"), o = t.indexOf("("), n = o; n < e; n++) {
                    "(" == t.charAt(n) && (o = n);
                }
                var i = t.substring(o + 1, e),
                    s = this.calcExpressionWithoutQuote(i);
                t = t.substring(0, o) + s + t.substring(e + 1, t.length);
            }
            return this.calcExpressionWithoutQuote(t);
        }),
        (t.prototype.getCharCountInString = function (t, e) {
            return t.split(e).length - 1;
        }),
        (t.prototype.isOperatorChar = function (t) {
            return "+-*/".indexOf(t) > -1;
        }),
        (t.prototype.random = function (t, e) {
            this.seed = (9301 * this.seed + 49297) % 233280;
            var o = this.seed / 233280;
            return parseInt(e + o * (t - e));
        }),
        (t.prototype.generateUUID = function () {
            var t = new Date().getTime();
            return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) {
                var o = (t + 16 * Math.random()) % 16 | 0;
                return (t = Math.floor(t / 16)), ("x" == e ? o : (3 & o) | 8).toString(16);
            });
        }),
        t
    );
})())();
o.default = n;
